package com.tccmeta.matchmaker.controller;

import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.api.WxMpService;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author:xiaoyu
 * @Created on 2018/9/17
 * @Description 公众号网页授权登录
 */
@Controller
@Slf4j
public class BackUserController {

    @GetMapping("/role/list")
    public ResponseEntity role() {
        Map map = new HashMap<>();
        map.put("code","0000");
        String json = "[\n" +
                "  {\n" +
                "    path: '/dashboard',\n" +
                "    component: '#',\n" +
                "    redirect: '/dashboard/analysis',\n" +
                "    name: 'Dashboard',\n" +
                "    meta: {\n" +
                "      title: 'router.dashboard',\n" +
                "      icon: 'ant-design:dashboard-filled',\n" +
                "      alwaysShow: true\n" +
                "    },\n" +
                "    children: [\n" +
                "      {\n" +
                "        path: 'analysis',\n" +
                "        component: 'views/Dashboard/Analysis',\n" +
                "        name: 'Analysis',\n" +
                "        meta: {\n" +
                "          title: 'router.analysis',\n" +
                "          noCache: true\n" +
                "        }\n" +
                "      },\n" +
                "      {\n" +
                "        path: 'workplace',\n" +
                "        component: 'views/Dashboard/Workplace',\n" +
                "        name: 'Workplace',\n" +
                "        meta: {\n" +
                "          title: 'router.workplace',\n" +
                "          noCache: true\n" +
                "        }\n" +
                "      }\n" +
                "    ]\n" +
                "  },\n" +
                "  {\n" +
                "    path: '/external-link',\n" +
                "    component: '#',\n" +
                "    meta: {},\n" +
                "    name: 'ExternalLink',\n" +
                "    children: [\n" +
                "      {\n" +
                "        path: 'https://element-plus-admin-doc.cn/',\n" +
                "        name: 'DocumentLink',\n" +
                "        meta: {\n" +
                "          title: 'router.document',\n" +
                "          icon: 'clarity:document-solid'\n" +
                "        }\n" +
                "      }\n" +
                "    ]\n" +
                "  },\n" +
                "  {\n" +
                "    path: '/matchmaker',\n" +
                "    component: '#',\n" +
                "    redirect: '/matchmaker/list',\n" +
                "    name: 'Example',\n" +
                "    meta: {\n" +
                "      title: '红娘',\n" +
                "      icon: 'ep:management',\n" +
                "      alwaysShow: true\n" +
                "    },\n" +
                "    children: [\n" +
                "      {\n" +
                "        path: 'list',\n" +
                "        component: 'views/Matchmaker/List',\n" +
                "        name: 'list',\n" +
                "        meta: {\n" +
                "          title: '未匹配列表'\n" +
                "        }\n" +
                "      },\n" +
                "      {\n" +
                "        path: 'matedList',\n" +
                "        component: 'views/Matchmaker/MatedList',\n" +
                "        name: 'matedList',\n" +
                "        meta: {\n" +
                "          title: '已匹配列表'\n" +
                "        }\n" +
                "      },\n" +
                "      {\n" +
                "        path: 'setting',\n" +
                "        component: 'views/Matchmaker/Setting',\n" +
                "        name: 'Setting',\n" +
                "        meta: {\n" +
                "          title: '设置'\n" +
                "        }\n" +
                "      }\n" +
                "    ]\n" +
                "  }\n" +
                "]\n";
        Map role = new HashMap();
        role.put("list",JSONUtil.parseArray(json));
        map.put("data", role );
        return ResponseEntity.ok(map);
    }
    @GetMapping("/user/loginOut")
    public ResponseEntity loginOut() {
        Map map = new HashMap<>();
        map.put("code","0000");
        return ResponseEntity.ok(map);
    }
    @PostMapping("/user/login")
    public ResponseEntity login(Map user) {
        user.put("username","admin");
        user.put("password","admin");
        user.put("role","admin");
        user.put("roleId","1");
        Map map = new HashMap();
        map.put("code","0000");
        map.put("data",user);

        return ResponseEntity.ok(map);
    }


}
